	<layout name="newlayout" />
		<script src="__JS__jquery.form.js" type="text/javascript"></script>
	<STYLE>
   .clear {  clear: both;   }
	.input_class{width:15px;height:10px;}
.num{margin: 0 5px 0 0;padding: 3px 6px;color: #57a000;text-decoration: none;border: 1px solid #ddd;-webkit-border-radius: 4px;border-radius: 4px;}
.current{margin: 0 5px 0 0;padding: 3px 6px;color: #57a000;text-decoration: none;border: 1px solid #ddd;-webkit-border-radius: 4px;border-radius: 4px;background: #469400 url('{__IMG__}bg-button-green.gif') top left repeat-x !important;border-color: #459300 !important;color: #fff !important;}
.star{color:red;}
#myModal{
	display: block;
left: 50%;
margin-left: -223px;
z-index: 1002;
position: fixed;
top: 50%;
margin-top: -159px;
-moz-border-radius: 6px;
background: #eef2f7;
-webkit-border-radius: 6px;
border: 1px solid #536376;
-webkit-box-shadow: rgba(0,0,0,.6) 0px 2px 12px;
-moz-box-shadow: rgba(0,0,0,.6) 0px 2px 12px;
padding: 14px 22px;
width: 500px;
display: none;}
	</STYLE>
	<div id="main-content"> <!-- Main Content Section with everything -->
			<!-- Page Head -->
			<div class="content-box"><!-- Start Content Box -->
				
				<div class="content-box-header">
					
					<h3>基本设置</h3>
					
					<ul class="content-box-tabs">
						<li><a href="#tab1" class="default-tab">列表</a></li> <!-- href must be unique and match the id of target div -->
					</ul>
					
					<div class="clear"></div>
					
				</div> <!-- End .content-box-header -->
				
				<div class="content-box-content">
					
					<div class="tab-content default-tab" id="tab1"> <!-- This is the target div. id must match the href of this div's tab -->
						
						<div class="notification attention png_bg">
							<a href="#" class="close"><img src="__IMG__cross_grey_small.png" title="Close this notification" alt="close" /></a>
							<div>
								提示：
							</div>
						</div>
						
						<table>
							
							<thead>
								<tr>
								   <th>ID</th>
								   <th>名称</th>
								   <th>内容</th>
								   <th>更新时间</th>
								   <th>操作</th>
								</tr>
								
							</thead>
						 
							<tfoot>
								<tr>
									<td colspan="6">
										<div class="bulk-actions align-left">
											<a class="button" href="javascript:"   onclick="add_set()">新增</a>
										</div>
										<div class="clear"></div>
									</td>
								</tr>
							</tfoot>
						 
							<tbody>
								<form action="/admin/WebSet/index" method="post" id="web_up">
         						<foreach name="config" item="vo" >  
								<tr>
								 <td>{$vo.id}</td>
						            <td> {$vo.title}<?php if(!empty($vo['img'])){?><a style="margin-left:5px;" href="<?php echo $vo['img']?>" target="_blank">图片</a><?php }?></td>
						            <td><php>echo htmlspecialchars($vo['content'])</php></td>
						            <td>{$vo.up_date}</td>
						            <td>
										<!-- Icons -->
										 <a  href="javascript:"   title="修改"><img src="__IMG__pencil.png" alt="Edit"  onclick="webUp({$vo.id});"/></a>
										 <a href="javascript:"  title="删除"><img src="__IMG__cross.png" alt="Delete"  onclick="webDe({$vo.id});"/></a> 
									</td>
								</tr>
									</foreach>
							</form>
							</tbody>
						</table>
					</div> 
				</div> 
			</div> 
		</div>
<div  id="myModal"  >
      	<form action="/admin/WebSet/index" method="post" id="web_add" style="width:50%;">
      	<input id="img"  type="hidden" name="img"/>
      	<input id="id"  type="hidden" id="id" name="id"/>
			      	  <div  style="position: relative;">
			      	  <label >新增/修改：</label>
			     	 </div>
			    	<div >
				    <label >名称</label>
				    <input type="text" class="text-input" id="title" name="title">
				  </div>
				  <div >
				    <label >内容</label>
				    <textarea id="content"  cols="8" name=content></textarea>
				  </div>
				  <div id="beizhu">
				    <label >备注:<span style="color:red;"></span></label>
				    <input type="text" class="text-input" id="remark"  name="remark" >
				  </div>
				  </form>
				 <!-- 						缩略图上传 -->
						<style>
	                     .upload-img-thumb{width:100%;position: relative;}
	                     .upload-img-thumb1{position: absolute;left:60%;border:1px solid #eee;border-top:2px solid #eec;-webkit-border-radius: 6px;border-radius: 6px;top:0px;}
						.upload-img-thumb2{margin: 0 auto; width: 167px; margin-bottom: 20px;}
	                     #img_preview{width: 167px; height: 125px;}
	                     #file_upload{margin:0 auto;}
						</style>
							<div class="upload-img-thumb"></div>
							<div class="upload-img-thumb1">
							<div class="upload-img-thumb2">
								<img  <?php if($data['thumb']){?>src="<?=$data['thumb'] ?>" <?php }else{?> src="__IMG__images.jpg" <?php }?>  id="img_preview">
							</div>
							<div style="width: 100%;">
									<div class="col-lg-6" style="width:100%;">
										<div class="input-group" >
													<input id="file_upload" name="thumb" type="file" multiple="true">
										</div>
										<div style="width:90px;margin:0 auto;">
										<a href="javascript:$('#file_upload').uploadify('cancel')" class="button" >删除</a>
										<a href="javascript:$('#file_upload').uploadify('upload')" class="button" style="">上传</a>
										</div>
									</div>
							</div>
							</div>
								<script type="text/javascript">
								    $(function() {
								        $('#file_upload').uploadify({
								       	 'auto'     : false,
								            'swf'      : '/Public/js/uploadify.swf',    //指定上传控件的主体文件
								            'uploader' : '/admin/logining/imgUpload',    //指定服务器端上传处理文件
								            'onUploadSuccess' : function(file, data, response) {
								                $("#img_preview").attr("src",data);
								 	 			$("#img").val(data);
								            }
								        });
								    });
								</script>
<!-- 							end 缩略图上传 -->
  <a class="button "  onclick="add_set();">Close</a>
        <a class="button"  onclick="save();">保存</a>
</div><!-- /.modal -->
<script>
function add_set(){
	 $("#id").val("");
		$("#title").val("");
		$("#content").val("");
		$("#img").val("");
			$("#img_preview").attr("src","/Public/images/images.jpg");
			var str="<label >备注:<span style=\"color:red;\"></span></label> <input type=\"text\" class=\"text-input\" id=\"remark\"  name=\"remark\" >";
			$("#beizhu").html(str);
	 $("#myModal").slideToggle("slow");
}

function save(){
	$("#web_add").submit();
}

//删除文章
function webDe(id){
	  if(confirm("确定删除?")){
		  $.post("/admin/WebSet/webDe",{id:id},function(data){
	        	 location.reload();
	             });     
		  };
	  }

//修改图片
function webUp(id){
     $.post("/admin/WebSet/webUp",{id:id},function(data){
 		var str="<label >备注:<span style=\"color:red;\">"+data['remark']+"</span></label>";
		$("#beizhu").html(str);
    	 $("#id").val(data['id']);
 		$("#title").val(data['title']);
 		$("#content").val(data['content']);
 		$("#img").val(data['img']);
 		if(data['img']==""){
 			$("#img_preview").attr("src","/Public/images/images.jpg");
 	 		}else{
 	 			$("#img_preview").attr("src",data['img']);
 	 	 		}
 		 $("#myModal").slideToggle("slow");
         });
	}
	  
</script>






